<?php

	include "../controller/ConectBanco.php";

class DriverDAO{

	function insert(Driver $driver){
	    									
		mysql_query("INSERT INTO driver SET nome = '".$driver->getNome()."'
										  , porta = ".$driver->getPorta())	or die (mysql_error());	
		
		header("location:../view/ListaDrivers.php");
		
	}
	
	function delete($idDriver){
		mysql_query("DELETE FROM driver WHERE idDriver =".$idDriver) or die (mysql_error());	
		
		header("location:../view/ListaDrivers.php");
	}
	
	function update(Driver $driver){
		mysql_query("UPDATE driver SET nome='".$driver->getNome()."' 
									  ,porta='".$driver->getPorta()."' 
									  WHERE idDriver=".$driver->getIdDriver()) or die (mysql_error());	
		
		header("location:../view/ListaDrivers.php");
	}
}	
	
?>